<?php

namespace App\Models;

use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Classes extends Model
{
    use HasFactory;
    use HasDateTimeFormatter;

    protected $table = 'class';

    public function mechanism()
    {
        return $this->belongsTo(Administrator::class, 'mechanism_id');
    }

    public function students()
    {
        return $this->hasMany(Student::class, 'class_id');
    }

    public function books()
    {
        return $this->hasMany(TeachingMaterial::class, 'class_id');
    }

}
